import request from '@/config/axios'

// 听力资源 VO
export interface HearingVO {
  id: string // 唯一标识
  hearingName: string // 资源名称
  chapter: string // 章节
  bookId: number // 绑定的教材
  grade: number // 年级
  bookName: string // 书籍名称
  hearingUrl: string // 听力资源
}

// 听力资源 API
export const HearingApi = {
  // 查询听力资源分页
  getHearingPage: async (params: any) => {
    return await request.get({ url: `/xhyy/hearing/page`, params })
  },

  // 查询听力资源详情
  getHearing: async (id: number) => {
    return await request.get({ url: `/xhyy/hearing/get?id=` + id })
  },

  // 新增听力资源
  createHearing: async (data: HearingVO) => {
    return await request.post({ url: `/xhyy/hearing/create`, data })
  },

  // 修改听力资源
  updateHearing: async (data: HearingVO) => {
    return await request.put({ url: `/xhyy/hearing/update`, data })
  },

  // 删除听力资源
  deleteHearing: async (id: number) => {
    return await request.delete({ url: `/xhyy/hearing/delete?id=` + id })
  },

  // 导出听力资源 Excel
  exportHearing: async (params) => {
    return await request.download({ url: `/xhyy/hearing/export-excel`, params })
  },
}